var express = require('express');
var path = require('path');
const cors = require('cors');
var cookieParser = require('cookie-parser');
var commonRoute = require('./routes/common');
var uploadRoute = require('./routes/upload');
var bucketRoute = require('./routes/bucket');
var app = express();
var db = require('./config/dbconfig');
app.use(cors());
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use("/common", commonRoute);
app.use("/upload", uploadRoute);
app.use("/bucket", bucketRoute);
app.get('/', function(req, res, next) {
  res.send('respond with a resource');
});
app.listen(3000,(res)=>{
  db.createConnectPool()
  console.log("serve starting")
})

